package com.itheima.d02;

import java.util.Arrays;

public class Test {
    public static void main(String[] args) {
        //1.准备测试学生数据
        Student[] students = {
                new Student("小王", 180, 18),
                new Student("小张", 170, 29),
                new Student("小李", 165, 17),
                new Student("小赵", 160, 21)
        };

        Arrays.sort(students ,( o1,  o2)-> o1.getAge()-o2.getAge());
        for (int i = 0; i < students.length; i++) {
            Student student = students[i];
            System.out.println(student.getName()+" "+student.getAge());
        }
    }
}
